-
Notifications
You must be signed in to change notification settings - Fork 375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: grc20 dynamic call with registered interface #1275
feat: grc20 dynamic call with registered interface #1275
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1275 +/- ##
==========================================
+ Coverage 56.17% 56.66% +0.49%
==========================================
Files 439 425 -14
Lines 66242 64786 -1456
==========================================
- Hits 37209 36709 -500
+ Misses 26143 25225 -918
+ Partials 2890 2852 -38
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Also related to #1072 I believe |
@r3v4s you might need to run update You have 4 ways: Option1:
Option2:
Option3:
Option4:
I would personally prefer Option4 :) |
examples/gno.land/r/x/grc20_dynamic_call/registry/registry_test.gno
Outdated
Show resolved
Hide resolved
537bf53
to
db05596
Compare
converting to draft to fix testcase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this detailed PR 🙏
Please check out @harry-hov's comments about the unused import, otherwise it looks good 💯
@@ -0,0 +1,130 @@ | |||
package baz | |||
|
|||
import ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest using either a bar or baz instead of exposing public methods. Create a safe object with the following code:
var baz = grc20.NewAdminToken(...)
var Baz = baz.GRC20()
// call Baz.Approve, etc directly
This recommendation reduces the codebase and eliminates redundancy. It demonstrates that the registry can function with standard public-facing grc20 implementations or grc20 objects. Ideally, keep a single foo file with public methods, while keeping the other files around 30 lines long. This approach will make the example more powerful and concise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
calling Baz.Transfer()
does panic VM call panic: cannot modify external-realm or non-realm object
because of updating its token balance.
as @tbruyelle mentioned, #1257 fix need to be settle down for this pr to use grc20 object instead of public methods
900da31
to
36ef3bb
Compare
Is this PR still relevant? |
#2516 implements more simple way, therefore closing this issue. |
allow certain contract to call grc20 functions(Transfer,TransferFrom,BalanceOf) without import by using registered interface
// co-worker @mconcat
relate pr
Contributors' checklist...
BREAKING CHANGE: xxx
message was included in the description